< previous page page_263 next page >

Page 263
0263-01.jpg
Figure 9.11
Program Morph displaying the 20th of 30 tweens.
The next several sections describe ways you can create animated scene transitions. With only a little work, you can replace one image with another using wipes, tiles, and spirals. These methods are simple but produce impressive results that can make an otherwise dull operation interesting.
The final sections of the chapter explain how you can build screen savers and animated icons. These sections discuss mostly Visual Basic programming details. By applying these details to the techniques presented in previous sections, you can create interesting and useful animated utilities.
Scene Transitions
When a program switches from one image to another, it can add extra interest using animation techniques. By copying parts of the new image over the old one, you can create wipes, tiles, and other motion picture style transition effects.
Example program Scenes demonstrates several different transitions. Click the button for the technique you want to see, and the program will switch between two images using that technique. The routines that implement the different effects are stored in module Wipes.bas to make it easier for you to include them in your applications.
You can use either Visual Basic's PaintPicture method or the BitBlt API function to copy parts of one image onto another. PaintPicture is a little easier to use, but BitBlt is faster. Program Scenes uses BitBlt so that it can produce useful effects on slower computers.
Wipes
A wipe is one image drawn across another. A horizontal wipe, for example, might begin drawing the new image over the left edge of the old image. Over time, more and more of the new image is drawn on top of the old one, until only the new image remains.
Wipes are relatively straightforward with Visual Basic. The program uses PaintPicture or BitBlt to copy more and more of the new image over the old one. The following code shows how program Scenes wipes a picture over another one from left to right. The

 
< previous page page_263 next page >